/*
 * Copyright (c)  2016, 
 * All rights reserved.
 * SettlementDetail.java 2016-06-23 上午10:25
 */

package com.ueboot.weishop.entity.finance;

import com.ueboot.weishop.entity.IDEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.Date;

/**
 * 描述:结算结果明细表,保存两边对账后的结果明细
 *
 * @author yangkui create on 2016-06-23.
 * @since 1.0
 */
@Data
@NoArgsConstructor
@Entity(name ="WS_SETTLEMENT_DETAIL")
public class SettlementDetail extends IDEntity {
    public static final String STATUS_SUCCESS="对账成功";
    public static final String STATUS_FAIL="对账失败";


    /* 物理主键 */
    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "WS_SETTLEMENT_DETAIL")
    @GenericGenerator(name = "WS_SETTLEMENT_DETAIL", strategy = "enhanced-table", parameters = {
            @org.hibernate.annotations.Parameter(name = "table_name", value = "WS_TABLE_SEQUENCE"),
            @org.hibernate.annotations.Parameter(name = "segment_value", value = "WS_SETTLEMENT_DETAIL"),
            @org.hibernate.annotations.Parameter(name = "optimizer", value = "pooled") })
    @Column(name = "ID",columnDefinition = "INT(20) COMMENT 'id主键'",length = 20)
    private Long id;
    /**
     * 结算日期
     */
    @Column(name = "SETTLE_DATE",columnDefinition = "VARCHAR(40) COMMENT '结算日期'",length = 40)
    private Date settleDate;

    /**
     * 订单编号
     */
    @Column(name = "ORDER_NO",columnDefinition = "VARCHAR(40) COMMENT '订单编号'",length = 40)
    private String orderNo;

    /**
     * 订单价格
     */
    @Column(name = "ORDER_PRICE",columnDefinition = "INT(11) COMMENT '订单价格'",length = 11)
    private Long orderPrice;

    /**
     * 结算金额
     */
    @Column(name = "SETTLEMENT_AMOUNT",columnDefinition = "INT(11) COMMENT '结算金额'",length = 11)
    private Long settlementAmount;

    /**
     * 手续费
     */
    @Column(name = "FEE",columnDefinition = "INT(11) COMMENT '手续费'",length = 11)
    private Long fee;

    /**
     * 状态
     */
    @Column(name = "STATUS",columnDefinition = "VARCHAR(40) COMMENT '状态'",length = 40)
    private String status;

    /**
     * 对账失败原因
     */
    @Column(name = "ERROR_MSG",columnDefinition = "VARCHAR(200) COMMENT '对账失败原因'",length = 200)
    private String errorMsg;

    /**
     * 结算批次号
     */
    @Column(name = "BATCH_NO",columnDefinition = "VARCHAR(40) COMMENT '结算批次号'",length = 40)
    private String batchNo;

    /**
     * 交易号
     */
    @Column(name = "TRANS_NO",columnDefinition = "VARCHAR(40) COMMENT '交易号'",length = 40)
    private String transNo;

    /**
     * 交易类型 消费|退货|撤销消费
     */
    @Column(name = "TRANS_TYPE",columnDefinition = "VARCHAR(40) COMMENT '交易类型 消费|退货|撤销消费'",length = 40)
    private String transType;

    /**
     * 交易金额 数值型，以分为单位
     */
    @Column(name = "PRICE",columnDefinition = "INT(11) COMMENT '交易金额 数值型，以分为单位'",length = 11)
    private Long price;

    /**
     * 原交易号
     */
    @Column(name = "EXTERNAL_REF_NUMBER",columnDefinition = "VARCHAR(40) COMMENT '原交易号'",length = 40)
    private String externalRefNumber;

    /**
     * 手动对账备注
     */
    @Column(name = "REMARK",columnDefinition = "VARCHAR(2000) COMMENT '手动对账备注'",length = 2000)
    private String remark;

}